CString::比较操作符

BOOL operator ==( const CString& s1, const CString& s2 );
BOOL operator ==( const CString& s1, LPCTSTR s2 );
BOOL operator ==( LPCTSTR s1, const CString& s2 );
BOOL operator !=( const CString& s1, const CString& s2 );
BOOL operator !=( const CString& s1, LPCTSTR s2 );
BOOL operator !=( LPCTSTR s1, const CString& s2 );
BOOL operator < ( const CString& s1, const CString& s2 );
BOOL operator < ( const CString& s1, LPCTSTR s2 );
BOOL operator < ( LPCTSTR s1, const CString& s2 );
BOOL operator > ( const CString& s1, const CString& s2 );
BOOL operator > ( const CString& s1, LPCTSTR s2 );
BOOL operator > ( LPCTSTR s1, const CString& s2 );
BOOL operator <=( const CString& s1, const CString& s2 );
BOOL operator <=( const CString& s1, LPCTSTR s2 );
BOOL operator <=( LPCTSTR s1, const CString& s2 );
BOOL operator >=( const CString& s1, const CString& s2 );
BOOL operator >=( const CString& s1, LPCTSTR s2 );
BOOL operator >=( LPCTSTR s1, const CString& s2 );

返回值:如果字符串满足比较条件则返回非零值;否则返回0。

参数:
s1, s2要比较的CString对象。

说明:
这些比较操作符用来比较两个字符串。它们是区分大小写的Compare成员函数的方便的代用符。

示例:
// CString比较操作符示例:
CString s1( "abc" );
CString s2( "abd" );
ASSERT( s1 < s2 ); // Operator is overloaded for both.
ASSERT( "ABC" < s1 ); // CString and char*
ASSERT( s2 > "abe" );